
def enCode(info):
    # 进行凯撒编码
    result = ''
    for i in info:
        if ord('a') <= ord(i) <= ord('z'):
            result += chr(ord('a') + (ord(i) - ord('a') + 3 ) % 26)
        else:
            pass
    print('进行凯撒加密后:%s' %result)

def reverse(result):
    #进行字符串的反转
    info = ''
    for i in range(len(result) - 1,-1,-1):
        info += result[i]
    print('进行字符反转结果后:%s' %info)
    enCode(info)

def letter(info):
    # 将用户输入的非英文字符剔除
    result = ''
    for i in info:
        if (ord(i) >= 65 and ord(i) <= 90) or (ord(i) >= 97 and ord(i) <= 122):
            # 字符为英文字符
            result += i
        else:
            # 用户输入非英文字符
            pass
    print('进行非英文字符剔除后:%s' %result)
    reverse(result)
            

# 验证基本输入，长度在（0-255之间]
def main():
    info = input('请输入内容:')
    a = len(info)
    if len(info) <= 0 or len(info) > 255:
        print('非法输入，长度范围:(0-255]')
    else:
        letter(info)

main()
